function judgeNumber(obj){
	if(isNaN(obj.value)){
		obj.value="0";		
	}else
		return ;
}

/** *扩展原型函数 */
String.prototype.fillChar = function(length,mode,char){    
    if(!char){
        char = "0";    
     }    
    if(this.length>length){// 比实际想要的长度更大
        if(mode=="after"){// 如果是要在后面填充，截取的时候会将会后面的部分截取掉
            return this.substr(0,length);    
         } else {// 默认截取前一部分的数据
            return this.substr(this.length - length,length);    
         }    
     }    
    var appendStr = "";    
    for(var i = 0; i < (length - this.length)/char.length;i++){    
         appendStr += char;    
     }    
    if(mode == "after"){    
        return this + appendStr;    
     }    
    else {    
        return appendStr + this;    
     }    
}

if (typeof String.prototype.startsWith != 'function') {
	  String.prototype.startsWith = function (str){
	    return this.slice(0, str.length) == str;
	  };
	}
if (typeof String.prototype.endsWith != 'function') {
	  String.prototype.endsWith = function (str){
	    return this.slice(-str.length) == str;
	  };
	}

Array.prototype.insertAt = function( index, value ) {
	var part1 = this.slice( 0, index );         
	var part2 = this.slice( index );         
	part1.push( value );         
	return( part1.concat( part2 ) );     
	
};       
Array.prototype.removeAt = function( index ){
	var part1 = this.slice( 0, index );         
	var part2 = this.slice( index );         
	part1.pop();         
	return( part1.concat( part2 ) );     
	
} 
Array.prototype.concatAt = function (index,ary){
	var part1 = this.slice( 0, index );         
	var part2 = this.slice( index );         
	var temp = part1.concat(ary);         
	return( temp.concat( part2 ) );   
}

function test() {

}
function toJsonString(obj){
	return JSON.stringify(obj);
}

function doPost(uri,data,callback){	
	  
	 $.post(getFullUrl(uri),data,function(html){
		 $("#contentbody").html(html);
		 if($.isFunction(callback)){
			callback(html);
		 }
	  });	  
}

function doGet(uri,data,callback){
	  var url = getFullUrl(uri);
	  //console.log(url);
	  $("#contentbody").load(url,data,function(html){
		  if($.isFunction(callback)){
				callback(html);
			 }
	  });	
}



function doSubmit(uri,data,ensure){
	if(ensure && !confirm('确认进行此操作!')){
		return ;
	}
	$.post(getFullUrl(uri),data);
}


function getFullUrl(uri){
	if(uri.startsWith('/')) return appContext+uri;
	return appContext+'/'+uri;
}

function isIE(){
   if(-[1,]){
     return false;
}else{
     return true;
}

}

function createNotify(title, text) {
	jQuery.pnotify( {
		pnotify_title : title,
		pnotify_text : text,
		pnotify_hide : true,
		pnotify_type : 'error',
		pnotify_delay : 3000
	});
}


function createSticky(title, text) {
	jQuery.pnotify( {
		pnotify_title : title,
		pnotify_text : text,
		pnotify_hide : false,
		pnotify_type : 'error'
	});
}

function resetForm(id){
	$(':input','form#'+id)
	 .not(':button, :submit, :reset,:radio')
	 .val('')
	 .removeAttr('checked')
	 .removeAttr('selected');

}

/**
 * 根据元素类型创建form元素 <input type="text" /> <input type="checkbox" /> <input
 * type="radio" /> <input type="image" /> <input type="file" /> <input
 * type="submit" /> <input type="reset" /> <input type="password" /> <input
 * type="button" /> <select><option/></select> <textarea></textarea> 返回的是jq对象
 */
function elementByType(type){
	switch(type){
	case "select":
		var e = $("<select></select>");
		return e;
	case "label":
		var e = $("<label></label>");
		return e;
	case "textarea":
		return $("<textarea></textarea>");
		;
	case "img":
		return $("<img></img>");
		;
	default:
		return $("<input type='"+type+"' />");
		;
	}
}